package com.terren.spider.entity;

import java.io.Serializable;
import java.lang.reflect.Field;




public class BasicEntity implements Cloneable,Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 5422192679383017903L;
	/**
	 * 数据库连接类型
	 */
	protected String dbType;


	public String getDbType() {
		return dbType;
	}

	public void setDbType(String dbType) {
		this.dbType = dbType;
	}
	/**
	 * 
	 */
	@Override
    public String toString() {
        StringBuilder sb = new StringBuilder("[");
        Field[] fields = getClass().getDeclaredFields();
        for (Field field : fields) {
            try {
                field.setAccessible(true);
                sb.append(field.getName()).append(":").append(field.get(this)).append(",");
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        // 去掉多于的逗号
        if(sb.length() > 1){
            sb.deleteCharAt(sb.length()-1);
        }
        sb.append("]");
        return sb.toString();
    }

	@Override
	public Object clone() {   
        try {   
            return super.clone();   
        } catch (CloneNotSupportedException e) {   
            return null;   
        }   
    }   
}
